﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class usermess : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["se1"] == null)
        {
            lit.Text = "<script>alert('请登录');</script>";
            Response.Redirect("~/index.aspx");
        }
        else
        {
            loginname.Text = Session["se1"].ToString();
            int userID = Convert.ToInt32(Session["userID"]);
            Xqsys.MODEL.Users user = new Xqsys.MODEL.Users();
            Xqsys.MODEL.JobType jobType = new Xqsys.MODEL.JobType();
            user.UserID = userID;
            DataSet da = new Xqsys.BLL.Users().SelectUserID(user);
            Session["jobID"] = da.Tables[0].Rows[0]["jobID"];
            if (Session["jobID"].ToString().Trim() != "")
            {
                DataSet da1 = new Xqsys.BLL.JobType().SelectJob(jobType);
                Label7.Text = da1.Tables[0].Rows[0]["jobName"].ToString();
            }
            else
            {
                Label7.Text = Session["jobID"].ToString();
            }
            if (Session["Role"].ToString() == "2")//为什么用 “==” 不可以 之后要改回来
            {
                Panel1.Visible = true;
                Panel2.Visible = true;
                Panel3.Visible = true;
            }
            else
            {
                Panel1.Visible = false;
                Panel2.Visible = false;
                Panel3.Visible = false;
            }
            Label1.Text = da.Tables[0].Rows[0]["userName"].ToString();
            Label2.Text = da.Tables[0].Rows[0]["loginTimes"].ToString();
            Label3.Text = da.Tables[0].Rows[0]["mark"].ToString();
            Label4.Text = da.Tables[0].Rows[0]["email"].ToString();
            Label5.Text = da.Tables[0].Rows[0]["realName"].ToString();
            Label6.Text = da.Tables[0].Rows[0]["sex"].ToString();
            Label8.Text = da.Tables[0].Rows[0]["phone"].ToString();
            Label9.Text = da.Tables[0].Rows[0]["address"].ToString();
            Label10.Text = da.Tables[0].Rows[0]["introduction"].ToString();            
        }
    }
    protected void zhuxiao_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("~/index.aspx");
    }
}